//
//  CLSearchResultCell.m
//  chanlin
//
//  Created by shuhui on 15-6-21.
//  Copyright (c) 2015年 chanlin. All rights reserved.
//

#import "CLSearchResultCell.h"
#import "INHtmlElement.h"
#import "CLGloble.h"
#import "UIImageView+WebCache.h"

@interface CLSearchResultCell()

@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UIImageView *seprator;
@property (nonatomic,strong) UIImageView *iconImgView;
@property (nonatomic,strong) UIView *selectView;
@property (nonatomic,strong) UIImageView *titleImg;

@property (nonatomic,strong) NSDictionary *dic;

@end
@implementation CLSearchResultCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        // cell重用会自动高亮上次选中的，解不了，只能恢复到以前没有点击效果的状态了
        // self.selectionStyle = UITableViewCellSelectionStyleDefault;
        
        _selectView = [[UIView alloc] init];
        // _selectView.backgroundColor = ICurrentTheme.docStyle.releativeSelectBg;
        _selectView.backgroundColor=[UIColor colorWithWhite:(float)0xd6/0xff alpha:1.0];
        
        _selectView.frame = self.bounds;
        self.selectedBackgroundView = _selectView;
        //        self.selectView = _selectView;
        
        _seprator=[[UIImageView alloc] init];
        //_seprator.image=[UIImage imageNamed:ICurrentTheme.cellStyle.indexCellSeperator];
        _seprator.image=[UIImage imageNamed:@"seperator_line.png"];
        
        [self.contentView addSubview:_seprator];
        
        self.titleLabel=[[UILabel alloc] initWithFrame:CGRectMake(12+80+12, 0, 204, self.bounds.size.height)];
        _titleLabel.backgroundColor = [UIColor clearColor];
        
        self.titleLabel.textAlignment = NSTextAlignmentLeft;
        self.titleLabel.numberOfLines = 0;
        self.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
        //self.titleLabel.textColor = ICurrentTheme.docStyle.releativeTitleColor;
        self.titleLabel.textColor=RGB(0x22, 0x22, 0x22);
        
        self.titleLabel.font = [UIFont systemFontOfSize:17];
        self.titleLabel.autoresizingMask =UIViewAutoresizingFlexibleHeight;
        [self.contentView addSubview:self.titleLabel];
        
        self.titleImg=[[UIImageView alloc] init];
        self.titleImg.frame=CGRectMake(12, 12.0f, 80.0f, 59.0f);
        //self.titleImg.image=[UIImage imageNamed:ICurrentTheme.docStyle.docRelationImg];
        //        self.titleImg.image=[UIImage imageNamed:@"doc_relative.png"];
        
        
        [self addSubview:self.titleImg];
        

        
        
        self.dic = [[NSDictionary alloc]init];
        
    }
    return self;
}

- (void)docDic:(NSDictionary *)dic{
    self.dic = dic;
    [self.titleImg sd_setImageWithURL:[NSURL URLWithString:[dic sgrGetStringForKey:@"titlepic"]]
                     placeholderImage:[UIImage imageNamed:@"index_thumbnail.png"]];
    
}

@end
